package it.sd.utility;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegExpTokenizer2 {
    
    private Matcher matcher;
    private String next;

    public RegExpTokenizer2(String testo, String pattern) {
        
        Pattern p= Pattern.compile(pattern);
        matcher = p.matcher(testo);
    }

    public boolean hasNext() {
        if (matcher == null) {
            return false;
        }
        if (matcher.find()) {
            next= matcher.group();
            return true;
        } else {
        	return false;
        }
    }

    public String next() {
        return next;
    }


}